home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_200 / 271_02 / dvid.doc < prev    next >
Text File  |  1987-08-18  |  8KB  |  144 lines

  1.  
  2.  
  3.         NAME
  4.                Direct Video Access Routines
  5.  
  6.  
  7.         SYNOPSIS
  8.                (void) dvid_attrib(attribute);  set an attribute
  9.                (void) dvid_bios();             force use of bios routines
  10.                (void) dvid_chgattrib(srow, scol, erow, ecol, attribute);
  11.                                                alter attribute in an area
  12.                (void) dvid_done();             de-initialize the functions
  13.                (void) dvid_e2eol();            erase cursor to end of line
  14.                (void) dvid_e2eos();            erase cursor to end of screen
  15.                (void) dvid_flush();            update real cursor position
  16.                attribute = dvid_getattr();     fetch the current attribute
  17.                value = dvid_getchr(row, col);  get character and attribute
  18.                (void) dvid_init();             initialize the functions
  19.                (void) dvid_move(row, col);     set internal cursor position
  20.                (void) dvid_putchr(ch);         write a character to the screen
  21.                (void) dvid_scroll(lines, srow, scol, erow, ecol, attribute);
  22.                                                scroll a region of the screen
  23.                (void) dvid_setpage(page, mode); set video page for writing,
  24.                                                 reading, and display
  25.                (void) dvid_sync(mode);         enable or disable video sync
  26.  
  27.                int attribute;          video attribute
  28.                int value;              attribute/character as packed word
  29.                int srow;               starting row number
  30.                int erow;               ending row number
  31.                int row;                absolute row number
  32.                int scol;               starting column number
  33.                int ecol;               ending column number
  34.                int col;                absolute column number
  35.                int lines;              mode for region scroll
  36.                int page;               video page number 0-7
  37.                int mode;               BOOLEAN flag (TRUE or FALSE)
  38.                char ch;                8 bit character value
  39.  
  40.  
  41.         DESCRIPTION
  42.         The direct video access functions are described in some detail
  43.         in the users manual accompanying "Steve's Library".  They are
  44.         only briefly reviewed here.  Be sure to look at the utility
  45.         file "dump.c" for examples of function usage.
  46.  
  47. direct video functions,      page 2
  48.  
  49.         dvid_attrib(attribute) sets the video (attribute) used for
  50.                     subsequent memory writes.
  51.         dvid_bios() may be called to force use of rom-bios services
  52.                     if problems are encountered using memory access.
  53.         dvid_chgattrib(srow, scol, erow, ecol, attrib) may be used to
  54.                     alter the attributes on a region of the screen
  55.                     starting at row (srow) and column (scol), up
  56.                     to and including (erow) and (ecol), to the
  57.                     new (attribute).  This provides a means of
  58.                     changing the color of a region of the screen
  59.                     from 1 character to the full screen without
  60.                     altering the character data in memory.
  61.         dvid_done() is called before exiting a program to restore
  62.                     screen characteristics.  It may also be used
  63.                     from within a program to restore all default
  64.                     values within the direct video package.
  65.         dvid_e2eol() and dvid_e2eos() are used to erase (to spaces)
  66.                     the screen from the current internal cursor
  67.                     position to the end of the line (e2eol) or the
  68.                     end of the current video page (e2eos).
  69.         dvid_flush() is called to force the onscreen cursor to
  70.                     the position defined by the "internal" cursor
  71.                     position.  During video writes, an internal
  72.                     cursor position is maintained, but the onscreen
  73.                     cursor is NOT automatically updated to reflect
  74.                     the current writing position.  This function
  75.                     resolves the discrepancy.
  76.         dvid_getattr() is used to return the current attribute used
  77.                     for writing.  It will return the value previously
  78.                     set with dvid_attrib().
  79.         dvid_getchr(row, col) returns the character and screen attribute
  80.                     at (row) and (col) on the current video page.
  81.                     The value is returned as a 16 bit value, with
  82.                     the low 8 bits being the character, and the upper
  83.                     8 bits the attribute.
  84.         dvid_init() MUST be called before any other dvid* functions are
  85.                     used.  This function discovers the type of video
  86.                     card and mode in use and sets internal variables
  87.                     accordingly.
  88.         dvid_move(row, col) sets the "internal" cursor to the specified
  89.                     (row) and (col) positions.  Subsequent writes to
  90.                     the screen will begin at this position.
  91.         dvid_putchr(char) is the real workhorse of these functions.  It
  92.                     is this function which writes the specified (char)
  93.                     to the screen memory with the current attribute
  94.                     at the current internal row/col position.
  95.         dvid_scroll() scrolls a region of the screen.  If the first
  96.                     argument is equal to 0 the region is cleared.
  97.                     If less than zero, the region is scrolled down.
  98.                     If greater than zero, scrolled up.
  99.  
  100. direct video functions,      page 3
  101.  
  102.         dvid_setpage(page, mode) is used ONLY with CGA cards, which
  103.                     may switch their video "pages".  In 40 column modes,
  104.                     there are 8 pages numbered 0-7.  In 80 column modes,
  105.                     there are 4 pages, numbered 0-3.  Any page may be
  106.                     set for reading or writing, while setting a different
  107.                     or the same page for actual display.  The (page)
  108.                     argument specifies the page number desired for
  109.                     writing, and is checked against the current video
  110.                     mode for correctness.  The (mode) argument is 0
  111.                     to select the page for writing/reading only,
  112.                     without changing the page current specified for
  113.                     display.  (mode) set to 1 also changes the displayed
  114.                     page to the indicated (page).  This function may
  115.                     therefore be used to alter not only the destination
  116.                     for direct memory writes, but also may be used to
  117.                     switch the display to the various pages.
  118.          dvid_sync(mode) is used to control video synchronization on CGA
  119.                     cards.  Normally, the functions default to sync enabled
  120.                     to prevent video "snow" during writes.  (mode) may be
  121.                     set to FALSE to disable video sync.  On some color
  122.                     cards, no snow will result evem without sync.  For
  123.                     all cards, disabling sync will speed up access, although
  124.                     the resulting "snow" may be objectionable.
  125.                     N.B.: Often, there will be a little snow on the left
  126.                     edge of the screen, even with video sync enabled.
  127.                     Turning off the visible cursor using cursor_style()
  128.                     in this library can often eliminate the snow, which
  129.                     is actually caused by the cursor itself.
  130.  
  131.  
  132.         To fully understand all the implications of video access, please
  133.         refer to one of the several good texts on MS-DOS programming.
  134.         Some are:
  135.             "Programmer's Guide to the IBM-PC"
  136.                 Norton, Peter    Microsoft Press
  137.             "Assembly Language Book for the IBM-PC"
  138.                 Norton, Peter et. al.    Prentice-Hall Press
  139.